import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    token: '',
    username: ''
  }),
  actions: {
    setToken(token: string) {
      this.token = token
    },
    clear() {
      this.token = ''
      this.username = ''
    }
  },
  persist: true // 开启持久化
})